package com.augurit.gzcgwsp.sendNotice.convert;

import java.util.ArrayList;
import java.util.List;

import org.dozer.DozerBeanMapper;
import com.augurit.gzcgwsp.sendNotice.entity.YwZhengwuInfo;
import com.augurit.gzcgwsp.sendNotice.web.form.YwZhengwuInfoForm;

public class YwZhengwuInfoConvert {
	public static YwZhengwuInfoForm convertVoToForm(YwZhengwuInfo entity) {
		if(entity != null) {
			YwZhengwuInfoForm form = new DozerBeanMapper().map(entity, YwZhengwuInfoForm.class);
			return form;
		}else
			return null;
	}
	
	public static List<YwZhengwuInfoForm> convertVoListToFormList(List<YwZhengwuInfo> ywWebserviceInfoList) {
		if(ywWebserviceInfoList != null && ywWebserviceInfoList.size() > 0) {
			List<YwZhengwuInfoForm> ywYnJzfqwczzXnFormList = new ArrayList();
			for(int i=0; i<ywWebserviceInfoList.size(); i++) {
				ywYnJzfqwczzXnFormList.add(convertVoToForm(ywWebserviceInfoList.get(i)));
			}
			return ywYnJzfqwczzXnFormList;
		}
		return null;
	}
	
	
	public static void convertFormToVo(YwZhengwuInfoForm form, YwZhengwuInfo entity) {
        if (form == null) return;
        if (entity == null) entity = new YwZhengwuInfo();        
        new DozerBeanMapper().map(form, entity);
    }
	
	public static List<YwZhengwuInfo> convertFormListToVoList(List<YwZhengwuInfoForm> YwZhengwuInfoFormList) {
		if(YwZhengwuInfoFormList != null && YwZhengwuInfoFormList.size() > 0) {
			List<YwZhengwuInfo> ywWebserviceInfoList = new ArrayList();
			for(int i=0; i<YwZhengwuInfoFormList.size(); i++) {
				YwZhengwuInfo YwZhengwuInfo = new YwZhengwuInfo();
				convertFormToVo(YwZhengwuInfoFormList.get(i), YwZhengwuInfo);
				ywWebserviceInfoList.add(YwZhengwuInfo);
			}
			return ywWebserviceInfoList;
		}
		return null;
	}
	
}
